-- kill_monster.c
-- Created by zouyb Mar/14/2015
-- 击杀怪物统计

local handle = function(para)
    -- 如果不是在地牢内就忽略
    if not DungeonM.isInDungeon() then
        return;
    end

    -- 已杀的怪物数量
    local addPoints = PropStatM.getData1(ME.user, "kill_monster_bonus");
    addPoints = addPoints + 1;
    PropStatM.setData1(ME.user, "kill_monster_bonus", addPoints);

    -- 触发prop
    local props = PropM.fetchProps(ME.user, "kill_monster_bonus");
    for _, prop in ipairs(props) do
        PropM.trigger(ME.user, prop[1], prop[2]);
    end
end

-- 怪物死亡事件
EventMgr.register("prop_stat/kill_monster", event.MONSTER_DIE, handle);